home *** CD-ROM | disk | FTP | other *** search
- --------------------------------------------------
- -- Created By: Sten
- -- Description: Rear Threatened Behaviour
- --------------------------
-
- AIBehaviour.MutantRearThreatened = {
- Name = "MutantRearThreatened",
-
- ---------------------------------------------
- OnSpawn = function( self, entity )
- -- called when enemy spawned or reset
- end,
- ---------------------------------------------
- OnActivate = function( self, entity )
- -- called when enemy receives an activate event (from a trigger, for example)
- end,
- ---------------------------------------------
- OnNoTarget = function( self, entity )
- -- called when the enemy stops having an attention target
- end,
- ---------------------------------------------
- OnBored = function( self, entity )
- -- called when the enemy is a little bored
- end,
- ---------------------------------------------
- OnPlayerSeen = function( self, entity, fDistance )
- -- called when the enemy sees a living player
- if (fDistance < 15) then
- AI:Signal(0,1,"ON_ENEMY_TOOCLOSE",entity.id);
- entity:SelectPipe(0,"rear_target2close");
- else
- AI:Signal(0,1,"ON_ENEMY_TARGET",entity.id);
- entity:SelectPipe(0,"rear_scramble");
- end
-
- if (AI:GetGroupCount(entity.Properties.groupid) > 1) then
- AI:Signal(SIGNALFILTER_GROUPONLY, 1, "HEADS_UP_GUYS",entity.id);
- entity:InsertSubpipe(0,"DropBeaconAt"); -- in PipeManagerShared.lua
- end
- end,
- ---------------------------------------------
- OnEnemySeen = function( self, entity )
- -- called when the enemy sees a foe which is not a living player
- end,
- ---------------------------------------------
- OnFriendSeen = function( self, entity )
- -- called when the enemy sees a friendly target
- end,
- ---------------------------------------------
- OnDeadBodySeen = function( self, entity )
- -- called when the enemy a dead body
- end,
- ---------------------------------------------
- OnEnemyMemory = function( self, entity )
- end,
- ---------------------------------------------
- OnInterestingSoundHeard = function( self, entity )
- -- called when the enemy hears an interesting sound
- entity:SelectPipe(0,"rear_approach_threat"); -- in PipeManagerShared.lua
- entity:InsertSubpipe(0,"DropBeaconTarget"); -- in PipeManagerShared.lua
- end,
- ---------------------------------------------
- OnThreateningSoundHeard = function( self, entity )
- -- called when the enemy hears a scary sound
- entity:SelectPipe(0,"rear_approach_threat"); -- in PipeManagerShared.lua
- entity:InsertSubpipe(0,"DropBeaconTarget"); -- in PipeManagerShared.lua
- end,
- ---------------------------------------------
- OnReload = function( self, entity )
- -- called when the enemy goes into automatic reload after its clip is empty
- end,
- --------------------------------------------------
- OnNoHidingPlace = function( self, entity, sender )
- -- called when no hiding place can be found with the specified parameters
- end,
- ---------------------------------------------
- OnBulletRain = function ( self, entity, sender)
-
- -- DO NOT TOUCH THIS READIBILITY SIGNAL ------------------------
- AI:Signal(SIGNALID_READIBILITY, 1, "GETTING_SHOT_AT",entity.id);
- ----------------------------------------------------------------
-
- AI:Signal(SIGNALFILTER_GROUPONLY, 1, "INCOMING_FIRE",entity.id);
-
- -- Make this guy alerted
- entity:MakeAlerted();
-
- entity:SelectPipe(0,"rear_goforcover");
- end,
- ---------------------------------------------
- OnReceivingDamage = function ( self, entity, sender)
-
- -- DO NOT TOUCH THIS READIBILITY SIGNAL ------------------------
- AI:Signal(SIGNALID_READIBILITY, 1, "GETTING_SHOT_AT",entity.id);
- ----------------------------------------------------------------
-
- AI:Signal(SIGNALFILTER_GROUPONLY, 1, "INCOMING_FIRE",entity.id);
-
- -- Make this guy alerted
- entity:MakeAlerted();
-
- -- the character will go into UnderFire behaviour after this function
- entity:SelectPipe(0,"rear_goforcover");
- end,
- --------------------------------------------------
- OnGrenadeSeen = function( self, entity, fDistance )
- -- called when the enemy sees a grenade
- --System:LogToConsole("+++++++++++++++++++++++++++OnGrenadeSeen");
- entity:InsertSubpipe(0,"grenade_run_away");
- end,
- --------------------------------------------------
- -- CUSTOM SIGNALS
- --------------------------------------------------
- OnGroupMemberDied = function( self, entity, sender)
- -- called when a member of the group dies
- --System:LogToConsole(entity:GetName().." recieved OnGroupMemberDied signal in RearIdle");
- entity:MakeAlerted();
-
- if (entity ~= sender) then
- entity:SelectPipe(0,"rear_goforcover");
- end
- end,
- --------------------------------------------------
- OnGroupMemberDiedNearest = function ( self, entity, sender)
- --System:LogToConsole(entity:GetName().." recieved OnGroupMemberDiedNearest signal in CoverIdle");
-
- entity:MakeAlerted();
-
- -- DO NOT TOUCH THIS READIBILITY SIGNAL ---------------------------
- AI:Signal(SIGNALID_READIBILITY, 1, "FRIEND_DEATH",entity.id);
- -------------------------------------------------------------------
-
- -- bounce the dead friend notification to the group (you are going to investigate it)
- AI:Signal(SIGNALFILTER_SPECIESONLY, 1, "OnGroupMemberDied",entity.id);
-
- entity:SelectPipe(0,"rear_goforcover");
- end,
- ---------------------------------------------
- Cease = function( self, entity, fDistance )
- entity:SelectPipe(0,"rear_cease_approach"); -- in PipeManagerShared.lua
- end,
- --------------------------------------------------
- ----------------- GROUP SIGNALS ------------------
- --------------------------------------------------
- HEADS_UP_GUYS = function (self, entity, sender)
- if (entity ~= sender) then
- entity:MakeAlerted();
- entity:SelectPipe(0,"rear_headup");
- end
- end,
- ---------------------------------------------
- INCOMING_FIRE = function (self, entity, sender)
- end,
- ------------------------------------------------------------------------
- ------------------------------ Animation -------------------------------
- target_lost_animation = function (self, entity, sender)
- local XRandom = random(1,2);
- if (XRandom == 1) then
- entity:StartAnimation(0,"_curious1",0);
- elseif (XRandom == 2) then
- entity:StartAnimation(0,"_curious2",0);
- end
- end,
- ------------------------------------------------------------------------
- confused_animation = function (self, entity, sender)
- entity:StartAnimation(0,"_headscratch2",0);
- end,
- ------------------------------------------------------------------------
- }